package day05;
import java.util.Arrays;
public class HomeWork {
    public static void main(String[] args) {


      /*
        int score = 0;
        for(int i =1;i<=10;i++){
            int a =(int)(Math.random()*100);
            int b =(int)(Math.random()*100);
            int result = a+b;
            System.out.println("("+i+")"+a+"+"+b+"=?");
            System.out.println("算吧!");
            int answer = scan.nextInt();
            if (answer==result){
                System.out.println("答对了");
                score+=10;

            }else {
                System.out.println("答错了");
            }



        }
        System.out.println("总分为："+score);


       */
        /*
        for (int num =1; num<=9;num++){
            for (int i =1; i <=num;i++){
                System.out.print(i+"*"+num+"="+i*num+"\t");

            }
            System.out.println();

        }

         */
        /*
        int[] arr =new int[10];
        int[] arr1=new int[3];//0,0,0
        int[] arr2={2,5,8};
        int[] arr3=new int[]{2,5,8};
        int[] arr4;
        arr4=new int[]{2,5,8};


         */
        /*


        int[] arr =new int[3];
        System.out.println(arr.length);
        arr[0]=100;
        arr[1]=200;
        arr[2]=300;
        System.out.println(arr[arr.length-1]);


         */
        /*
        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {

        arr[i] = (int) (Math.random() * 100);
        System.out.println(arr[i]);


         */
        /*
        int []arr = new int[10];
        for (int i =0;i<arr.length;i++ ){
            arr[i]=(int) (Math.random()*100);
            System.out.println(arr[i]);


            }
        int max = arr[0];
        for (int i =1;i<arr.length;i++){
            if (arr[i]>max){
                max=arr[i];


            }


        }
        System.out.println("最大值为："+max);


         */
        int []arr = new int[10];
        for (int i =0;i<arr.length;i++ ){
            arr[i]=(int) (Math.random()*100);
            System.out.println(arr[i]);
        }
        Arrays.sort(arr);
        System.out.println("排序后：");
        for (int i =1;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("倒着输出：");
        for (int i =arr.length-1 ;  i>=0 ; i--){
            System.out.println(arr[i]);


        }
        System.out.println("第一个元素为："+arr[0]);














    }
}
